<?php
	include_once dirname(__FILE__).'/common.php';

	$upload = $_GET['upload'];
	if(empty($upload)){
		$arr = array(
			'status'	=> 0,
			'msg'		=> '上传值为空',
		);
	}else{
		$upload = substr($upload,22);

		$image = base64_decode($upload);

		$tempname = md5($GLOBALS['timestamp']+random(3)).'.png';

		$resp = file_put_contents($GLOBALS['config']['upload_path'].$tempname, $image);

		if($resp){
			$arr = array(
				'status'	=> 1,
				'msg'		=> '上传成功',
			);
		}else{
			$arr = array(
					'status'	=> 0,
					'msg'		=> '保存失败',
			);
		}
	}

	echo json_encode($arr);